<?php

if (!defined('FRAMEWORKS_RB_FUNCTIONS_INI')):

define('FRAMEWORKS_RB_FUNCTIONS_INI', true);
define('FRAMEWORKS_ROOT_PATH', XOOPS_ROOT_PATH.'/Frameworks');

function rb_load_class($handler = 'crud', $dirname = 'rb')
{
    $handler    = strtolower($handler);
	$className  = "Rb".ucfirst($handler)."Handler";
	$fileName   = "class.{$handler}.php"; 
    
    class_exists($className) || require_once FRAMEWORKS_ROOT_PATH . "/{$dirname}/{$fileName}";
    return class_exists($className);
}

function rb_load_object()
{
    return rb_load_class();
}

function rb_load_functions($group = '', $dirname = 'rb')
{
    $dirname = ('' == $dirname ) ? 'rb' : $dirname;
    $constant = strtoupper('frameworks_'.$dirname.'_functions'.(($group) ? '_'.$group : ''));
    if (defined($constant)) return true;
    return include_once FRAMEWORKS_ROOT_PATH.'/'.$dirname.'/functions.'.$group.(empty($group) ? '' : '.' ).'php';
}

endif;
?>